import da from "element-ui/src/locale/lang/da";


export function formatDateTime(date = new Date()) {
    return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + (date.getHours()) + ":" + date.getMinutes() + ":" + date.getSeconds()
}

export function formatDate(date) {
    let origin
    if (date instanceof Date) {
        origin = date
    } else {
        origin = new Date(date)
    }


    let year = origin.getFullYear();    //  返回的是年份
    let month = origin.getMonth() + 1;  //  返回的月份上个月的月份，记得+1才是当月
    let dates = origin.getDate();
    if (month < 10) month = "0" + month;
    if (origin < 10) origin = "0" + origin;
    let time = year + "-" + month + "-" + dates
    return time
}